package com.cts.rt.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.springframework.security.core.GrantedAuthority;

@Entity
@Table(name = "EMPLOYEE_LEVEL")
public class EmployeeLevel implements Serializable, GrantedAuthority {

	private static final long serialVersionUID = 8460596779172090642L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "ID")
	private Integer id;

	@Column(name = "NAME", nullable = false, length = 255)
	private String name;
	
	@Column(name = "ACCESS_NAME", nullable = false, length = 255)
	private String accessName;

	@Column(name = "CODE", nullable = false, length = 128)
	private String code;
	
	public EmployeeLevel () {
		
	}
	
	public EmployeeLevel (String name) {
		this.name = name;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}
	
	public String getAccessName() {
		return accessName;
	}

	public void setAccessName(String accessName) {
		this.accessName = accessName;
	}

	@Override
	public String getAuthority() {
		return getAccessName();
	}
}
